<?php 
if(!isset($_SESSION['tkemail'])){
		if(!isset($_COOKIE['role'])){
			//$_SESSION['action']='entry';
			header( 'Location: index.php?action=entry' );
		}else{
			$_SESSION['tkemail']=$_COOKIE["tkemail"];
		    $_SESSION['role']=$_COOKIE["role"];
			
			$role=$_SESSION['role'];
			$tkemail=$_SESSION['tkemail'];
		}
	}else{
		$role=$_SESSION['role'];
		$tkemail=$_SESSION['tkemail'];
	}
	if($tkemail==""){
		header( 'Location: index.php?action=entry' );
	}

?>

<link rel="stylesheet" type="text/css" href="js/jsDatePick_ltr.min.css" />
<link
	rel="stylesheet" type="text/css" href="css/style-login.css" />
<script
	type="text/javascript" src="js/jsDatePick.min.1.3.js"></script>
<script
	type="text/javascript"
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<link  href="css/jsDatePick_ltr.min.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
	new JsDatePick({
		useMode:2,
		target:"searchfrom",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"searchto",

		dateFormat:"%Y-%m-%d"
	});
};
</script>
<?php include 'connection/connection.php';?>
<?php 

	$lang=$_SESSION['lang'];
	if($lang=='')
			$lang='EN';
	
	if ( !isset($_REQUEST['page'] ))
	{
    	$page = 1 ;
	}else{
		$page = $_REQUEST['page'] ;
	}
	
	$rows_per_page = 20;
	$page_start = ( $page - 1 ) * $rows_per_page; 
	$page_end = $page * $rows_per_page;
	
	$datecurrent = date("Y-m-d");
	$temp2days = strtotime($datecurrent.'-1 days');
    $day2 =  date("Y-m-d",$temp2days);
	
    $temp7days = strtotime($datecurrent.'-6 days');
    $day7 =  date("Y-m-d",$temp7days);
    
	$temp1month = strtotime($datecurrent.'-1 months');
	$onemonth = date("Y-m-d",$temp1month);
	
	
	if(!isset($_REQUEST['page'])){
		$list["ui.email"]="DESC";
		$list["ls.server_ip"]="DESC";
		$list["ls.server_name"]="DESC";
		$list["ls.version"]="DESC";
		$list["ls.status"]="DESC";
		$list["ls.server_time"]="DESC";
		$list["ls.ins_time"]="DESC";
		
		$str="ls.ins_time";
		$_SESSION['sortn']=$str;
		$_SESSION['sort']=$list;
	}else{
		$str=$_SESSION['sortn'];
		$list=$_SESSION['sort'];
	}
	
if (isset($_REQUEST['search'])){
	$searchfrom = $_REQUEST['searchfrom'];
	$searchto = $_REQUEST['searchto'];
	$search = $_REQUEST['search'];
	$lstatus = $_REQUEST['status'];
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls 
		WHERE ls.id = ui.id and ls.ins_time >'".$searchfrom." 00:00:00' AND ls.ins_time<'".$searchto." 23:59:59' ";
	
	$sql.= " AND ls.`status` ='".$status."'";
	
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
	
}else if (isset($_REQUEST['searchAll'])){
	$lstatus = 'all';
	$searchfrom =date("Y-m-d");
	$searchto = date("Y-m-d");
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls WHERE ls.id = ui.id ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['searchone'])){
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls 
		WHERE ls.id = ui.id and ls.ins_time >'".$datecurrent." 00:00:00' and ls.ins_time<'".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search2day'])){
	$sql ="SELECT ls.*,ui.email FROM `user_info` ui, log_server ls 
		WHERE ls.id = ui.id and ls.ins_time >='".$day2." 00:00:00' and ls.ins_time<='".$datecurrent." 23:59:59'";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search1week'])){
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls
		 WHERE ls.id = ui.id and ls.ins_time >='".$day7." 00:00:00' and ls.ins_time<='".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}else if (isset($_REQUEST['search1month'])){
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls
		 WHERE ls.id = ui.id and ls.ins_time >='".$onemonth." 00:00:00' and ls.ins_time<='".$datecurrent." 23:59:59' ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}
else{
	$lstatus = 'all';
	$searchfrom =date("Y-m-d");
	$searchto = date("Y-m-d");
	$sql = "SELECT ls.*,ui.email FROM `user_info` ui, log_server ls WHERE ls.id = ui.id ";
	$selectlogserver = mysql_query($sql." ORDER BY ".$str." ".$list[$str]);
	$number_of_page = ceil ( mysql_num_rows( $selectlogserver ) / $rows_per_page ); 
}


?>
<script type="text/javascript">
function ajaxserachLogServer(page,search){
	var searchfrom = $('input#searchfrom').val();
	var searchto = $('input#searchto').val();
	var status = document.getElementById('status').value;
	var searchHostName = ""; 

	document.getElementById('search').setAttribute("class", "buttonNormalchoose");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logserver/ajaxserachLogServer.php", data : {pages : page,search : search,searchfrom : searchfrom,searchto : searchto,status : status,searchHostName : searchHostName}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

function ajaxsearchall(page,search){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';
	var searchHostName = "";

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logserver/ajaxSearchAllLogServer.php", data : {pages : page,search : search,searchHostName : searchHostName}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

function ajaxSearchLogServerByOneDay(page,search,searchOneDay){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';
	var searchHostName = "";
	
	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormalchoose");
	
	$.ajax({url:"ajax_logserver/ajaxSearchLogServerByOneDay.php", data : {pages : page,search : search,searchOneDay : searchOneDay,searchHostName : searchHostName}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

function ajaxSearchLogServerBy2Day(page,search,searchcurrent,searchlast2day){
	document.getElementById('searchfrom').value = "<?php echo date('Y-m-d',strtotime(date('Y-m-d').'-1 days'));?>";
	document.getElementById('searchto').value = "<?php echo date('Y-m-d');?>";
	document.getElementById('status').value = 'all';
	var searchHostName = "";
	
	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logserver/ajaxSearchLogServerByTwoDay.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast2day : searchlast2day,searchHostName : searchHostName}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

function ajaxSearchLogServerBy7Days(page,search,searchcurrent,searchlast7day){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';
	var searchHostName = "";

	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormalchoose");
	document.getElementById('search1month').setAttribute("class", "buttonNormal");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logserver/ajaxSearchLogServerBy7Day.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast7day : searchlast7day,searchHostName : searchHostName}, success:function(result){
		//$("table#tbLogServer tr:not(:first)").remove();
		//$("table#tbLogServer thead").append(result);
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

function ajaxSearchLogServerBy1Months(page,search,searchcurrent,searchlast1month){
	document.getElementById('searchfrom').value = "";
	document.getElementById('searchto').value = "";
	document.getElementById('status').value = 'all';
	var searchHostName = "";
	
	document.getElementById('search').setAttribute("class", "buttonNormal");
	document.getElementById('searchAll').setAttribute("class", "buttonNormal");
	document.getElementById('search2day').setAttribute("class", "buttonNormal");
	document.getElementById('search1week').setAttribute("class", "buttonNormal");
	document.getElementById('search1month').setAttribute("class", "buttonNormalchoose");
	document.getElementById('searchone').setAttribute("class", "buttonNormal");
	
	$.ajax({url:"ajax_logserver/ajaxSearchLogServerBy1Month.php", data : {pages : page,search : search,searchcurrent : searchcurrent,searchlast1month : searchlast1month,searchHostName : searchHostName}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}


//sort and paging
function sortandpagingLogServer(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	$.ajax({url:"ajax_logserver/sortandpagingLogServer.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}
function sortandpagingLogAllServer(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	$.ajax({url:"ajax_logserver/sortandpagingLogAllServer.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}
function sortandpagingLogServer1Day(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	//alert('search auto = ' + searchhostnameauto);
	$.ajax({url:"ajax_logserver/sortandpagingLogServer1Day.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		//$("table#tbLogServer").empty();
		//$("table#tbLogServer").append(result);
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}
function sortandpagingLogServer2Days(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	document.getElementById('searchfrom').value = "<?php echo date('Y-m-d',strtotime(date('Y-m-d').'-1 days'));?>";
	document.getElementById('searchto').value = "<?php echo date('Y-m-d');?>";
	$.ajax({url:"ajax_logserver/sortandpagingLogServer2Day.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}
function sortandpagingLogServer7Days(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	$.ajax({url:"ajax_logserver/sortandpagingLogServer1Week.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}
function sortandpagingLogServer1Month(page,string,flagDesc,search,from,to,status,oneday,twodays,oneweek,onemonth,searchhostnameauto){
	$.ajax({url:"ajax_logserver/sortandpagingLogServer1Month.php", data : {pages : page,str : string,flagDesc : flagDesc,search : search,from : from,to : to,status : status,oneday : oneday,twodays : twodays,oneweek : oneweek,onemonth : onemonth,searchhostnameauto : searchhostnameauto}, success:function(result){
		$("table#tbLogServer").empty();
		$("table#tbLogServer").append(result);
	}});
}

/// new new new 
function sortAutoServerHostName(str){
	$.ajax({url:"ajax_logserver/sortAutoServerHostName.php", data : {searchAutoHostname : str}, success:function(result){
		$("table#tbLogServer tr:not(:first)").remove();
		$("table#tbLogServer thead").append(result);
	}});
}
</script>
<div class="maincon1">
<div class="hbox">
	<h2>
	<?=$login?>
	</h2>
	<p>
	<?=$login1?>
	</p>
	<div class="seldown">
		<ul>
		<?php if ($role==0){?>
			<li class="hoso" style="float:left;">
	        	<a href="#" onclick="changePage('profile')" style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px"><span><?=$hoso?></span></a>
	        </li>
	        <li class="giayphep" style="float:left;">
	        	<a href="#" onclick="changePage('license')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
	        </li>
		<?php }else if ($role==1){?>
			<li class="hoso" style="float:left;">
	        	<a href="#" onclick="changePage('profile')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$hoso?></span></a>
	        </li>
	        <li class="giayphep" style="float:left;">
	        	<a href="#" onclick="changePage('license')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
	        </li>
	        <li class="server" style="float:left;">
	       	<a onclick="changePage('log_server')"  style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px;cursor: pointer;"><span class="choose" ><?=$logserver?></span></a>
	        </li>
	        <li class="viewer" style="float:left;">
	        	<a href="#"  onclick="changePage('logviewer')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logviewer?></span></a>
	        </li>
	        <li class="viewertoserver" style="float:left;">
	        	<a href="#"  onclick="changePage('log_viewertoserver')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logviewertoserver?></span></a>
	        </li>
		<?php }?>
	    	
  	  </ul>
	</div>
</div>
</div>
<div style="text-align: center;padding-left: 40px;">
<?=$l_from?> : <input type="text" id="searchfrom" name="searchfrom" style="height: 24px;width: 83px;">
<?=$l_to?> : <input type="text" id="searchto" name="searchto" style="height: 24px;width: 83px;">
<?=$namestatus?> : 
<select id="status" name="status" style="height: 24px;width: 100px;padding-top: 3px;">
	<option value="all"><?=$l_all?></option>
	<option value="login"><?=$login?></option>
	<option value="logout"><?=$logout?></option>
</select>
<input id="search" name="search" value="<?=$l_search?>"
			  class="buttonNormal" type="button" onclick="ajaxserachLogServer(1,'<?=$search?>')"/>
<input id="searchAll" name="searchAll" value="<?=$l_all?>"
			  class="buttonNormalchoose" type="button" onclick="ajaxsearchall(1,'<?=$search?>')" />
<input id="searchone" name="searchone" value="<?php echo $oneday?>"
			  class="buttonNormal" type="button" onclick="ajaxSearchLogServerByOneDay(1,'<?=$search?>','<?=$datecurrent?>')"/>
<input id="search2day" name="search2day" value="<?php echo $twoday?>"
			  class="buttonNormal" type="button" onclick="ajaxSearchLogServerBy2Day(1,'<?=$search?>','<?=$datecurrent?>','<?=$day2?>')"/>
<input id="search1week" name="search1week" value="<?php echo $oneweek?>"
			  class="buttonNormal" type="button" onclick="ajaxSearchLogServerBy7Days(1,'<?=$search?>','<?=$datecurrent?>','<?=$day7?>')"/>
<input id="search1month" name="search1month" value="<?php echo $one_month?>"
			  class="buttonNormal" type="button" onclick="ajaxSearchLogServerBy1Months(1,'<?=$search?>','<?=$datecurrent?>','<?=$onemonth?>')"/>
</div>
<div class="maind" style="padding-top: 15px;">
<?php 
$searchfrom = $_REQUEST['searchfrom'];
	$searchto = $_REQUEST['searchto'];
	$search = $_REQUEST['search'];
	$lstatus = $_REQUEST['status'];
	if (isset($_REQUEST['searchone'])){
		$datecurrent = date("Y-m-d");
	}else{
		$datecurrent = $_REQUEST['searchone'];
	}
	if (isset($_REQUEST['search2day'])){
		$day2 =  date("Y-m-d",$temp2days);
	}else {
		$day2 = $_REQUEST['search2day'];
	}
	if(isset($_REQUEST['search1week'])){
		$day7 =  date("Y-m-d",$temp7days);
	}else {
		$day7 = $_REQUEST['search1week'];
	}
	if (isset($_REQUEST['search1month'])){
		$onemonth = date("Y-m-d",$temp1month);
	}else{
		$onemonth = $_REQUEST['search1month'];
	}
?>
<div id="logserver" style="padding-left: 40px;">

	<table width="100%" cellpadding="0" cellspacing="0" class="mtable" id="tbLogServer">
		<thead>
			<tr>
				<td align="center" style="color: #696969;width: 4%"><?php echo $no?></td>
				<td align="center"><a onclick="sortandpagingLogServer('<?=$page?>','ui.email',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $useriforid?></a></td>
				<td align="center"><a onclick="sortandpagingLogServer('<?=$page?>','ls.server_ip',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteserverip ?></a></td>
				<td align="center">
					<a onclick="sortandpagingLogServer(<?=$page?>,'ls.server_name',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteserverhostname?></a>
					<input type="text" style="width: 150px;height: 24px;border: 1px red solid;padding-left: 5px;" id="searchHostName" name="searchHostName"  
					onkeyup="sortandpagingLogServer(<?=$page?>,'ls.server_name',1,'<?=$search?>','<?=$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>',this.value)">
					</td>
				<td align="center"><a onclick="sortandpagingLogServer(<?=$page?>,'ls.version',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteserverver?></a></td>
				<td align="center"><a onclick="sortandpagingLogServer(<?=$page?>,'ls.status',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $status?></a></td>
				<td align="center"><a onclick="sortandpagingLogServer(<?=$page?>,'ls.server_time',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $remoteservertime?></a></td>
				<td align="center"><a onclick="sortandpagingLogServer(<?=$page?>,'ls.ins_time',1,'<?=$search?>','<?=$_REQUEST['searchfrom']?>','<?=$_REQUEST['searchto']?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" style="cursor: pointer;color: #027acc"><?php echo $inserttime?></a></td>
			</tr>
		</thead>
		<?php
		if(mysql_num_rows($selectlogserver)>0){
			$i=0;
			while ($row = mysql_fetch_array($selectlogserver)){
				if ( $i >= $page_start ){?>
			<tr>
					<td align="center" style="width: 4%"><?php echo $i+1?></td>
					<td align="center"><?php echo $row[email] ?></td>
					<td align="center"><?php echo $row[server_ip] ?></td>
					<td align="center"><?php echo $row[server_name]?></td>
					<td align="center"><?php echo $row[version]?></td>
					<td align="center"><?php echo $row[status]?></td>
					<td align="center"><?php echo $row[server_time]?></td>
					<td align="center"><?php echo $row[ins_time]?></td>
				</tr>
		<?php
				}
					$i++;
					if ($i >= $page_end){
						break;
					}
				}
			}
		?>
		
		<tr>
					<td colspan="8" class="rf-dt-shdr-c">
						<span style="padding:1px; display: inline-block;">
													
							<?php if ( $number_of_page > 1 ) 
							{ 
								if ($page==1)
									$p=2;
								else if ($page==$number_of_page)
									$p=$number_of_page-1;
								else $p=$page;
								if($page!=1){?>
									<a onclick="sortandpagingLogServer(<?=1?>,'<?=$str?>',0,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')" ><span class='button_next'><?php echo "<<<";?></span> </a>
									<a onclick="sortandpagingLogServer(<?=($page-1)?>,'<?=$str?>',0,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')"><span class='button_next'><?php echo "<<";?></span> </a>
								<?php  }
								else{
									echo "<span class='button_next'><<<</span> "; 
									echo "<span class='button_next'><<</span> ";
								}
								for ( $i = $p-1; $i <= $p+1; $i++ ) {	
										if ($i<=$number_of_page && $i>0)
										
											if ($i==$page){
												echo "<span class='button_next'><b>".$i."</b></span>"; 
											}else{
											?>
												<a onclick="sortandpagingLogServer(<?=$i?>,'<?=$str?>',0,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')"><span class="button_next">
												<?php 
												echo $i;
												?>
												</span> </a>
												<?php 
											}
										?>
									
								<?php 
										}
									
									if($page!=$number_of_page){ ?>
										<a onclick="sortandpagingLogServer(<?=($page+1)?>,'<?=$str?>',0,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')"><span class='button_next'><?php echo ">>";?></span> </a>
										<a onclick="sortandpagingLogServer(<?=$number_of_page?>,'<?=$str?>',0,'<?=$search?>','<?$searchfrom?>','<?=$searchto?>','<?=$lstatus?>','<?=$datecurrent?>','<?=$day2?>','<?=$day7?>','<?=$onemonth?>','<?=$searchHostName?>')"><span class='button_next'><?php echo ">>>";?></span> </a>
									<?php }
									else{
										echo "<span class='button_next'>>></span> ";
										echo "<span class='button_next'>>>></span> ";
									}
								}
							
								
								?>
																					
						</span>
					</td>
				</tr>
	</table>
</div>
</div>
<?php mysql_close($connection);?>